package network4;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

//服务器端监听端口
public class ServerDemo {
    public static void main(String[] args) throws IOException {
        //创建服务器端socket对象
        ServerSocket serverSocket = new ServerSocket(1024);
        while (true){
            //监听客户端返回
            Socket accept = serverSocket.accept();
            //为每一个客户端开启一个线程
            new Thread(new ServerThread(accept)).start();
        }
    }
}
